package com.example.lagou_elasticsearch_homework.es.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.util.Date;

@Data
@Document(indexName = "position")
@NoArgsConstructor
public class PositionES {
    //主键
    @Id
    private String id;

    //公司名称
    @Field(type = FieldType.Keyword)
    private String companyName;

    //职位名称
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String positionName;

    //职位诱惑
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String  positionAdvantage;

    //薪资
    @Field
    private String salary;

    //薪资下限
    @Field
    private int salaryMin;

    //薪资上限
    @Field
    private int salaryMax;

    //学历
    @Field(type = FieldType.Keyword)
    private String education;

    //工作年限
    @Field(type = FieldType.Integer)
    private String workYear;

    //发布时间
    @Field(type = FieldType.Date,format = DateFormat.date)
    private String publishTime;

    //工作城市
    @Field(type = FieldType.Keyword)
    private String city;

    //工作地点
    @Field(type = FieldType.Text,analyzer = "id_max_word",store = true)
    private String workAddress;

    //创建时间store = true
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Field(type = FieldType.Date, format = DateFormat.basic_date)
    private Date createTime;

    //工作模式
    @Field(type = FieldType.Keyword)
    private String jobNature;
}
